/*
 * NormalFavorableMessageHolder.java
 * business
 *
 * Created by ChenTao on 2017/1/10.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.viewholder;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yidiandao.business.R;
import com.yidiandao.business.data.bean.Message;
import com.yidiandao.business.ui.widget.listview.ViewHolder;
import com.yidiandao.business.utils.ImageLoader;

/**
 * 常规促销信息-ViewHolder
 */
public class NormalFavorableMessageHolder extends ViewHolder {

    public LinearLayout rootLayout;
    private TextView tvTitle;
    private ImageView ivImage;
    private TextView tvDate;

    @Override
    protected void initView(View rootView) {
        tvTitle = (TextView) rootView.findViewById(R.id.tv_title);
        ivImage = (ImageView) rootView.findViewById(R.id.iv_image);
        tvDate = (TextView) rootView.findViewById(R.id.tv_date);
        rootLayout = (LinearLayout) rootView.findViewById(R.id.root_layout);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_normal_favorable_message;
    }

    public void refreshUI(Message message) {
        tvTitle.setText(message.getTitle());
        tvDate.setText(message.getAddTime());
        ImageLoader.loadImage(mContext, ivImage, message.getIcon());
    }
}
